DAST = DataStructures/
COMPS = computations/
BIN = ../bin/
OBJECTS = ${DAST}Atom.o ${DAST}Molecule.o
BABEL = /usr/include/openbabel-2.0

COMPILE = g++ -Wall -g -c -std=c++0x -I${BABEL}
LINK = g++ -Wall -g -std=c++0x -ldl -rdynamic ${OBJECTS} -lopenbabel -I${BABEL}

LIBS = libbasic.so libpermutations.so

all: ${BIN}main ${LIBS} movelibs

${BIN}main: ${OBJECTS} main.cpp
	${LINK} main.cpp -o ${BIN}main

${DAST}Molecule.o: ${DAST}Molecule.h ${DAST}Molecule.cpp
	${COMPILE} ${DAST}Molecule.cpp -o ${DAST}Molecule.o

${DAST}Atom.o: ${DAST}Atom.h ${DAST}Atom.cpp
	${COMPILE} ${DAST}Atom.cpp -o ${DAST}Atom.o
	
${BIN}${COMPS}lib%.so: lib%.so 
	mv $< ${BIN}${COMPS}	

lib%.so: 
	$(MAKE) -C ${COMPS} $@
	mv ${COMPS}$@ .

movelibs: 
	mv *.so ${BIN}${COMPS}
#	cp ${COMPS}*.h ${BIN}${COMPS}

clean:
	rm -rf ${OBJECTS}
	rm -rf ${BIN}${COMPS}*

.PHONY: all clean movelibs
